<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    var date = new Date();  //日期对象
    console.log(date);

    // 获取  年月日 星期 时分秒 毫秒
    var year = date.getFullYear();
    console.log(year);

    // 获取月份  => 月份(0-11)
    // 注意:如果要做展示效果  实际月份 = 获取的月份 + 1
    var month = date.getMonth();
    console.log(month);
    console.log("实际月份:",month+1);

    // 获取日期 
    var day = date.getDate();
    console.log(day);

    // 获取星期  => 星期(0-6   0:星期天)
    var week = date.getDay();
    console.log(week);

    var hour = date.getHours();
    console.log(hour);

    var minute = date.getMinutes();
    console.log(minute);

    var second = date.getSeconds();
    console.log(second);

    var millisecond = date.getMilliseconds();
    console.log(millisecond);

    // 获取当前日期对应的总的毫秒数
    var ms = date.getTime();
    console.log(ms);

    console.log("--------------------UTC--------------------------------");
    var year = date.getUTCFullYear();
    console.log(year);

    // 获取月份  => 月份(0-11)
    // 注意:如果要做展示效果  实际月份 = 获取的月份 + 1
    var month = date.getUTCMonth();
    console.log(month);
    console.log("实际月份:",month+1);

    // 获取日期 
    var day = date.getUTCDate();
    console.log(day);

    // 获取星期  => 星期(0-6   0:星期天)
    var week = date.getUTCDay();
    console.log(week);

    var hour = date.getUTCHours();
    console.log(hour);

    var minute = date.getUTCMinutes();
    console.log(minute);

    var second = date.getUTCSeconds();
    console.log(second);

    var millisecond = date.getUTCMilliseconds();
    console.log(millisecond);



</script>
</html>